var callbacks = {}
var on = function(eventName, handler){
	if ( ! callbacks[eventName]) {
		callbacks[eventName] = []
	}
	callbacks[eventName].push(handler)
}

var emit = function(eventName){
	if ( ! callbacks[eventName]) {
		return
	}
	var args = [].slice.call(arguments, 1)
	console.log(args)
	callbacks[eventName].forEach(function(handler) {
		handler.apply(null, args)
	});
}

on('meow', function(){
	console.log(1)
})

on('meow', function(){
	console.log(2)
})

on('meow', function(a, b){
	console.log(a,b)
})

emit('meow', 1, 3)